# Author    :Dun_Hz
# Time      :2024/3/17 14:11
# 分糖果，某个糖果大小s，某个孩子需要g，一个孩子仅能用一个糖果满足
# 判断能满足几个孩子
class Solution:
    def findContentChild(self,g,s):
        g = sorted(g)
        s = sorted(s)
        child = 0
        candy = 0
        while child<len(g) and candy<len(s):
            if g[child]<= s[candy]:
                child +=1
            #     candy +=1
            # else:
            #     candy +=1
            candy +=1

        return child

if __name__=='__main__':
    g=[5,10,2,9,15,7]
    s = [6,20,3,7,11,4]
    S = Solution()
    result = S.findContentChild(g,s)
    print(result)